﻿namespace Busconeitor.Domain.Utils.HashTable
{
    using System;
    using SimpleList;

    public class HashList : HashTable
    {
        private SimpleList myList;

        public HashList(int pSize)
            : base(pSize)
        {
            myList = new SimpleList();
        }

        public override void Put(IComparable x)
        {
            if (!Contains(x))
            {
                base.Put(x);
                myList.AddLast(x);
            }
        }

        public void StartIterator()
        {
            myList.StartIterator();
        }

        public Boolean HasNext()
        {
            return myList.HasNext();
        }

        public IComparable Next()
        {
            return myList.Next();
        }

        public int Size()
        {
            return myList.Size();
        }

        public override string ToString()
        {
            return myList.ToString();
        }
    }
}
